using Arcane.Source.Client.Extensions;
using Godot;

namespace Arcane.Source.Data;

public struct ElementData
{
    public string Name { get; set; }
    public Texture2D Icon { get; set; }
    public Texture2D Shape { get; set; }

    public static ElementData Create(ElementRes res)
    {
        var shapeImg = res.Shape.GetImage();
        shapeImg.ToSilhouette(res.ThemeColor);
        return new()
        {
            Name = TranslationServer.Translate(res.NamePath),
            Icon = res.Icon,
            Shape = ImageTexture.CreateFromImage(shapeImg),
        };
    }
}